load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("@rules_license//rules:license.bzl", "license")

package(
    default_visibility = ["//visibility:public"],
    default_applicable_licenses = [":license"],
)

exports_files([
    "LICENSE",
])

license(
    name = "license",
    license_kinds = ["@rules_license//licenses/spdx:BSD-3-Clause"],
    license_text = "LICENSE",
)

cc_library(
    name = "backtrace",
    srcs = [
        "backtrace.h",
        "atomic.c",
        "dwarf.c",
        "fileline.c",
        "internal.h",
        "posix.c",
        "print.c",
        "sort.c",
        "state.c",
        "config.h",
        "backtrace.c",
        "simple.c",
        "nounwind.c",
        "elf.c",
        "macho.c",
        "pecoff.c",
        "unknown.c",
        "read.c",
        "mmapio.c",
        "mmap.c",
        "filenames.h",
        "backtrace-supported.h",
    ],
    hdrs = [
        "backtrace.h",
    ],
    includes = ["."],
    linkstatic = 1,
    visibility = ["//visibility:public"],
)

alias(
    name = "libbacktrace",
    actual = ":backtrace",
    visibility = ["//visibility:public"],
)
